package com.project.starter.controller;

import com.project.starter.redis.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class HelloController {
    @Autowired
    private RedisService redisService;

    @RequestMapping(value = "/say",method = RequestMethod.GET)
    public String say(String name) {
        return "hi " + name;
    }

    @RequestMapping(value = "/redis",method = RequestMethod.GET)
    public String redis(@RequestParam("key") String key) {
       return redisService.getByKey(key);
    }

}
